package net.wzw.mapper.db_counter;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.wzw.mapper.db_user.UserCounterDO;
import org.springframework.data.repository.query.Param;

import java.util.Date;

/**
 * @author wzw
 * @date 2025/5/1
 * @Description 用户计数关系表 Mapper 接口
 */
public interface UserCounterMapper extends BaseMapper<UserCounterDO> {

    /**
     * 修改 user_id 对应的粉丝数
     *
     * **/
    int updateUserFoolowerCount(@Param(value = "user_id") Integer userId,
                                @Param(value = "count_key") String countKey,
                                @Param(value = "count_value") Integer count_value,
                                @Param(value = "last_count_value") Integer lastCountValue
    );

    /**
     * 修改 user_id 对应的关注数
     *
     * **/
    int updateUserAttentionCount(@Param(value = "user_id") Integer userId,
                                @Param(value = "count_key") String countKey,
                                @Param(value = "count_value") Integer count_value,
                                @Param(value = "last_count_value") Integer lastCountValue
    );

    /**
     * 查询 user_id 是否存在对应计数
     * @param userId
     * @return
     */
    int getUserById(@Param(value = "user_id") Integer userId, @Param(value = "count_key") String countKey);

    /**
     * 新增计数数据 这里可以改成对象那种
     * @param userId
     * @param countKey
     * @param countValue
     * @param lastCountValue
     */
    void addUserCounter(@Param(value = "user_id") Integer userId,
                        @Param(value = "count_key") String countKey,
                        @Param(value = "count_value") Integer countValue,
                        @Param(value = "last_count_value") Integer lastCountValue,
                        @Param(value = "create_time") Date createTime);

}
